#ifndef QUICKSEARCH_HPP_INCLUDED
#define QUICKSEARCH_HPP_INCLUDED

#include <QtCore/QString>
#include <QtSql/QtSql>

//use this to configure fields
#define USE_FIELD_TITLE     1
#define USE_FIELD_ARTIST    2
#define USE_FIELD_ALBUM     4
#define USE_FIELD_COMMENT   8
#define USE_FIELD_GENRE     16
#define USE_FIELD_TAG       32
#define USE_FIELD_FILENAME  64
///Built a query that searches for a song
class QuickSearch {
    private:
        ///If true create a query that uses phonetic, it requires SQLITE_SOUNDEX support
        bool useSoundex;
        ///text to search in the database
        QString text;
        ///Built query from given parameters
        QString query;
        /** Fields in the database to search, this is interpreted in binary
        bit 0: search in title
        bit 1: search in artist
        bit 2: search in album
        bit 3: search in comment
        bit 4: search in genre
        bit 5: search in tag
        bit 6: search in filename
        bit 7: not used
        **/
        char fields;
    public:
        //constructors
        QuickSearch();
        QuickSearch(QString searchText);
        QuickSearch(QString searchText, char fields);
        /** Configure fields by using the value (ie: setFields(USE_FIELD_TITLE|USE_FIELD_ARTIST|USE_FIELD_FILENAME)
        @param fields: use defines to configure fields
        */
        void setFields(char fields);
        void enableSoundex();
        void disableSoundex();
        void getQuery();
        void search(QString text);
};

#endif // QUICKSEARCH_HPP_INCLUDED
